﻿// --------------------------------
// <copyright file="ActucalSection.cs" company="TRONSoft">
//     Copyright (c) TRONSoft.
// </copyright>
// <license>
//   This source code is subject to terms and conditions of the Microsoft
//   Public License. A copy of the license can be found in the License.html
//   file at the root of this distribution. If you cannot locate the
//   Microsoft Public License, please send an email to dlr@microsoft.com.
//   By using this source code in any fashion, you are agreeing to be bound 
//   by the terms of the Microsoft Public License. You must not remove this
//   notice, or any other, from this software.
// </license>
// <author>Tron</author>
// ---------------------------------

using System.Configuration;

namespace Tronsoft.Actucal.CalculationEngineCreator.ScriptConfiguration
{
    /// <summary>
    /// This class represents the scriptGeneration element in the application's configuration file. see the example. 
    /// 
    /// Example:
    ///   <scriptGeneration>
    ///     <IntrinsicObject name="test1" sourceDirectory="c:\temp\input" processedDirectory="c:\temp\processed">
    ///         <scripts>
    ///             <clear/>
    ///             <add name="testScript1.txt" outputDirectory="c:\temp\output" template="c:\temp\script\template1.txt"  type="Tronsoft.Actucal.CalculationEngineCreator.FileNameReplacerProcessor, Tronsoft.Actucal.CalculationEngineCreator" />
    ///             <add name="testScript2.txt" outputDirectory="c:\temp\output" template="c:\temp\script\template2.txt" type="Tronsoft.Actucal.CalculationEngineCreator.FileNameReplacerProcessor, Tronsoft.Actucal.CalculationEngineCreator" />
    ///         </scripts>
    ///     </IntrinsicObject>
    ///    </scriptGeneration>
    /// 
    /// </summary>
    public class ActucalSection : ConfigurationSection
    {
        [ConfigurationProperty(ConfigurationSectionName.PROVIDERS)]
        public ProviderSettingsCollection Providers
        {
            get { return (ProviderSettingsCollection)base[ConfigurationSectionName.PROVIDERS]; }
        }

        [ConfigurationProperty(ConfigurationPropertyName.DEFAULT_PROVIDER, DefaultValue = DataProviderTypeName.SQL_SERVER)]
        public string DefaultProvider
        {
            get { return (string)base[ConfigurationPropertyName.DEFAULT_PROVIDER]; }
            set { base[ConfigurationPropertyName.DEFAULT_PROVIDER] = value; }
        }


        [ConfigurationProperty(ConfigurationPropertyName.ENABLE_TRACE, DefaultValue = "false")]
        public string EnableTrace
        {
            get { return (string)base[ConfigurationPropertyName.ENABLE_TRACE]; }
            set { base[ConfigurationPropertyName.ENABLE_TRACE] = value; }
        }

        [ConfigurationProperty(ConfigurationPropertyName.PLUGIN_DIRECTORY, DefaultValue = "")]
        public string TemplateDirectory
        {
            get { return (string)base[ConfigurationPropertyName.PLUGIN_DIRECTORY]; }
            set { base[ConfigurationPropertyName.PLUGIN_DIRECTORY] = value; }
        }

        /// <summary>
        /// The IntrinsicObject element collection that is a child of the scriptGeneration element.
        /// </summary>
        [ConfigurationProperty(ConfigurationSectionName.INTRINSIC_ELEMENT_COLLECTION, IsRequired = false)]
        public IntrinsicElementCollection IntrinsicObjects
        {
            get { return base[ConfigurationSectionName.INTRINSIC_ELEMENT_COLLECTION] as IntrinsicElementCollection; }
        }
    }
}

